-------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  C:\Users\Siyao\Dropbox\Yue-Siyao\Project Subsidy\PSRM replication files\governor_details.log
  log type:  text
 opened on:  18 Aug 2022, 21:39:53

. 
. use "governor_details.dta"

. 
. *set up fe
. egen industry_name_CSRC_f=group(industry_name_CSRC)

. egen industry_year=group(industry_name_CSRC year)

. egen province_year=group(provid year)

. encode current_gvn, gen(current_gvn_f)

. 
. *sanity check
. unique current_gvn //75 
Number of unique values of current_gvn is  75
Number of records is  1951

. 
. ******************
. *PROMOTION
. ******************
. *Figure 2 - Analysis on provincial governor subgroups: Promoted v. not
. preserve

. keep if gvn_promote2==1
(797 observations deleted)

. forval x=1/5{
  2. quietly reghdfe subsidy_assets_w  i.L`x'.gvn_turnover##i.private L.log_assets_w L.ROA_w, absorb(current_gvn_f 
> industry_year) vce(cluster provid)
  3. estimates store gvn_lag`x' //store the estimates of the entire regression and name it
  4. }

. 
. coefplot gvn_lag1 gvn_lag2 gvn_lag3 gvn_lag4 gvn_lag5, /// 
>     keep(1L.gvn_turnover#1.private 1L2.gvn_turnover#1.private ///
>         1L3.gvn_turnover#1.private 1L4.gvn_turnover#1.private 1L5.gvn_turnover#1.private) ///
>      yline(0, lp(dash))  vertical ///   
>         coeflabels(1L.gvn_turnover#1.private="+1" ///
>         1L2.gvn_turnover#1.private="+2" 1L3.gvn_turnover#1.private="+3" ///
>         1L4.gvn_turnover#1.private="+4" 1L5.gvn_turnover#1.private="+5") /// 
>         xtitle("Years after governor turnover", size(small)) ///
>         levels(95 90) legend(order(1 "95%" 2 "90%") rows(1) position(6))  ciopts(lwidth(*1 *2) lcolor(gray black)
> ) msymbol(C) ///
>         scheme(lean1)  
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)

. 
. *graph Figure2a.png, replace 
. restore

. 
. preserve

. keep if gvn_promote2==0
(1,154 observations deleted)

. forval x=1/5{
  2. quietly reghdfe subsidy_assets_w  i.L`x'.gvn_turnover##i.private L.log_assets_w L.ROA_w, absorb(current_gvn_f 
> industry_year) vce(cluster provid)
  3. estimates store gvn_lag`x'  
  4. }

. 
. coefplot gvn_lag1 gvn_lag2 gvn_lag3 gvn_lag4 gvn_lag5, ///code to generate the coefficient plot
>     keep(1L.gvn_turnover#1.private 1L2.gvn_turnover#1.private ///
>         1L3.gvn_turnover#1.private 1L4.gvn_turnover#1.private 1L5.gvn_turnover#1.private) ///matrix list e(b): re
> call coefficients saved previously but only use coefficients of interest
>      yline(0, lp(dash))  vertical /// line through 0 on the x-axis and hide legend, vertical plot 
>         coeflabels(1L.gvn_turnover#1.private="+1" ///
>         1L2.gvn_turnover#1.private="+2" 1L3.gvn_turnover#1.private="+3" ///
>         1L4.gvn_turnover#1.private="+4" 1L5.gvn_turnover#1.private="+5") ///rename coefficients 
>         xtitle("Years after governor turnover", size(small)) ///
>         levels(95 90) legend(order(1 "95%" 2 "90%") rows(1) position(6))  ciopts(lwidth(*1 *2) lcolor(gray black)
> ) msymbol(C) ///
>         scheme(lean1)  
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)
(note:  named style C not found in class symbol, default attributes used)

.         
. *graph export Figure2b.png, replace 
. restore

. 
. *Table A10 - Promotion of governors by tenure length
. preserve

. keep province year current_gvn gvn_tenure gvn_promote

. duplicates drop

Duplicates in terms of all variables

(1,703 observations deleted)

. tabout gvn_tenure gvn_promote using TableA10.tex, style(tex) format(0) replace

Table output written to: TableA10.tex

 & \multicolumn{3}{c}{gvn\_promote} \\
gvn\_tenure&0&1&Total \\
&No.&No.&No. \\
\hline
1&7&0&7 \\
2&25&2&27 \\
3&48&2&50 \\
4&34&3&37 \\
5&28&7&35 \\
6&8&24&32 \\
7&23&16&39 \\
8&8&0&8 \\
9&5&8&13 \\
Total&186&62&248 \\

. restore

. 
. ********************
. *RETIREMENT
. ********************
. *keep only governors that leave the post close to retirement age 65 (63,64,65) 
. gen gvn_age_num=real(gvn_age)
(520 missing values generated)

. drop if gvn_age=="NA"
(520 observations deleted)

. 
. *calculate governor starting age
. egen gvn_age_max = max(gvn_age_num), by(current_gvn province)

. gen gvn_age_start=gvn_age_max-gvn_tenure 

. egen gvn_start=min(gvn_age_start>58), by(current_gvn province)

. tab gvn_start

  gvn_start |      Freq.     Percent        Cum.
------------+-----------------------------------
          0 |      1,332       93.08       93.08
          1 |         99        6.92      100.00
------------+-----------------------------------
      Total |      1,431      100.00

. keep if gvn_start
(1,332 observations deleted)

. 
. *Table A13 - Governors near retirement 
. reghdfe subsidy_assets_w i.L.gvn_turnover##i.private, absorb(year industry_name_CSRC_f) vce(cluster provid)
(dropped 1 singleton observations)
(MWFE estimator converged in 2 iterations)
warning: missing F statistic; dropped variables due to collinearity or too few clusters

HDFE Linear regression                            Number of obs   =         26
Absorbing 2 HDFE groups                           F(   3,      1) =          .
Statistics robust to heteroskedasticity           Prob > F        =          .
                                                  R-squared       =     0.1035
                                                  Adj R-squared   =    -0.1206
                                                  Within R-sq.    =     0.0894
Number of clusters (provid)  =          2         Root MSE        =     0.3560

                                           (Std. Err. adjusted for 2 clusters in provid)
----------------------------------------------------------------------------------------
                       |               Robust
      subsidy_assets_w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------------+----------------------------------------------------------------
        L.gvn_turnover |
                    1  |   .1386872   .0546484     2.54   0.239    -.5556869    .8330614
                       |
             1.private |   .2774498   .0810805     3.42   0.181     -.752776    1.307676
                       |
L.gvn_turnover#private |
                  1 1  |  -.3552848   .0311238   -11.42   0.056    -.7507497    .0401801
                       |
                 _cons |   .0389465   .0652213     0.60   0.657    -.7897683    .8676613
----------------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------------+
          Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------------+---------------------------------------|
                 year |         1           0           1     |
 industry_name_CSRC_f |         3           1           2     |
--------------------------------------------------------------+

. est sto gvn_lag1_subass1

. reghdfe subsidy_assets_w i.L.gvn_turnover##i.private L.log_revenue_w, absorb(year industry_name_CSRC_f) vce(clust
> er provid)
(dropped 1 singleton observations)
(MWFE estimator converged in 2 iterations)
warning: missing F statistic; dropped variables due to collinearity or too few clusters

HDFE Linear regression                            Number of obs   =         26
Absorbing 2 HDFE groups                           F(   4,      1) =          .
Statistics robust to heteroskedasticity           Prob > F        =          .
                                                  R-squared       =     0.1348
                                                  Adj R-squared   =    -0.1384
                                                  Within R-sq.    =     0.1212
Number of clusters (provid)  =          2         Root MSE        =     0.3588

                                           (Std. Err. adjusted for 2 clusters in provid)
----------------------------------------------------------------------------------------
                       |               Robust
      subsidy_assets_w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------------+----------------------------------------------------------------
        L.gvn_turnover |
                    1  |   .1366205   .0189983     7.19   0.088    -.1047754    .3780164
                       |
             1.private |   .1973082   .0248843     7.93   0.080    -.1188767    .5134932
                       |
L.gvn_turnover#private |
                  1 1  |  -.3244183   .0080756   -40.17   0.016    -.4270292   -.2218074
                       |
         log_revenue_w |
                   L1. |  -.0533663   .0015989   -33.38   0.019    -.0736828   -.0330497
                       |
                 _cons |   .7124657   .0021705   328.25   0.002     .6848867    .7400446
----------------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------------+
          Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------------+---------------------------------------|
                 year |         1           0           1     |
 industry_name_CSRC_f |         3           1           2     |
--------------------------------------------------------------+

. est sto gvn_lag1_subass2

. reghdfe subsidy_assets_w i.L.gvn_turnover##i.private L.log_assets_w, absorb(year industry_name_CSRC_f) vce(cluste
> r provid)
(dropped 1 singleton observations)
(MWFE estimator converged in 2 iterations)
warning: missing F statistic; dropped variables due to collinearity or too few clusters

HDFE Linear regression                            Number of obs   =         26
Absorbing 2 HDFE groups                           F(   4,      1) =          .
Statistics robust to heteroskedasticity           Prob > F        =          .
                                                  R-squared       =     0.1279
                                                  Adj R-squared   =    -0.1476
                                                  Within R-sq.    =     0.1141
Number of clusters (provid)  =          2         Root MSE        =     0.3602

                                           (Std. Err. adjusted for 2 clusters in provid)
----------------------------------------------------------------------------------------
                       |               Robust
      subsidy_assets_w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------------+----------------------------------------------------------------
        L.gvn_turnover |
                    1  |   .1203805   .0337107     3.57   0.174    -.3079549    .5487158
                       |
             1.private |   .1980351   .0579794     3.42   0.181    -.5386627    .9347329
                       |
L.gvn_turnover#private |
                  1 1  |  -.3081063    .025466   -12.10   0.052    -.6316829    .0154703
                       |
          log_assets_w |
                   L1. |  -.0527747   .0074651    -7.07   0.089    -.1476282    .0420788
                       |
                 _cons |   .7493471   .1378593     5.44   0.116    -1.002321    2.501015
----------------------------------------------------------------------------------------

Absorbed degrees of freedom:
--------------------------------------------------------------+
          Absorbed FE | Categories  - Redundant  = Num. Coefs |
----------------------+---------------------------------------|
                 year |         1           0           1     |
 industry_name_CSRC_f |         3           1           2     |
--------------------------------------------------------------+

. est sto gvn_lag1_subass3

. reghdfe subsidy_assets_w i.L.gvn_turnover##i.private L.log_assets_w L.ROA_w, absorb(industry_year) vce(cluster pr
> ovid)
(dropped 1 singleton observations)
(MWFE estimator converged in 1 iterations)
warning: missing F statistic; dropped variables due to collinearity or too few clusters

HDFE Linear regression                            Number of obs   =         26
Absorbing 1 HDFE group                            F(   5,      1) =          .
Statistics robust to heteroskedasticity           Prob > F        =          .
                                                  R-squared       =     0.2623
                                                  Adj R-squared   =    -0.0246
                                                  Within R-sq.    =     0.2507
Number of clusters (provid)  =          2         Root MSE        =     0.3404

                                           (Std. Err. adjusted for 2 clusters in provid)
----------------------------------------------------------------------------------------
                       |               Robust
      subsidy_assets_w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------------+----------------------------------------------------------------
        L.gvn_turnover |
                    1  |   .2729807   .0186016    14.68   0.043     .0366244     .509337
                       |
             1.private |   .3124396   .0134682    23.20   0.027     .1413101    .4835691
                       |
L.gvn_turnover#private |
                  1 1  |  -.4951495   .0178304   -27.77   0.023     -.721706    -.268593
                       |
          log_assets_w |
                   L1. |   -.070333   .0100802    -6.98   0.091     -.198414    .0577481
                       |
                 ROA_w |
                   L1. |  -.0237382   .0059377    -4.00   0.156    -.0991835     .051707
                       |
                 _cons |   1.035844   .1721994     6.02   0.105    -1.152157    3.223846
----------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------+
   Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------+---------------------------------------|
 industry_year |         3           0           3     |
-------------------------------------------------------+

. est sto gvn_lag1_subass4

. reghdfe subsidy_assets_w i.L.gvn_turnover##i.private L.log_assets_w L.ROA_w, absorb(current_gvn_f industry_year) 
> vce(cluster provid)
(dropped 1 singleton observations)
note: 1bnL.gvn_turnover is probably collinear with the fixed effects (all partialled-out values are close to zero; 
> tol = 1.0e-09)
(MWFE estimator converged in 3 iterations)
warning: missing F statistic; dropped variables due to collinearity or too few clusters
note: 1L.gvn_turnover omitted because of collinearity

HDFE Linear regression                            Number of obs   =         26
Absorbing 2 HDFE groups                           F(   4,      1) =          .
Statistics robust to heteroskedasticity           Prob > F        =          .
                                                  R-squared       =     0.2623
                                                  Adj R-squared   =    -0.0848
                                                  Within R-sq.    =     0.2339
Number of clusters (provid)  =          2         Root MSE        =     0.3503

                                           (Std. Err. adjusted for 2 clusters in provid)
----------------------------------------------------------------------------------------
                       |               Robust
      subsidy_assets_w |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
-----------------------+----------------------------------------------------------------
        L.gvn_turnover |
                    1  |          0  (omitted)
                       |
             1.private |   .3124396    .013109    23.83   0.027     .1458744    .4790048
                       |
L.gvn_turnover#private |
                  1 1  |  -.4951495   .0173548   -28.53   0.022    -.7156634   -.2746356
                       |
          log_assets_w |
                   L1. |   -.070333   .0098113    -7.17   0.088    -.1949979     .054332
                       |
                 ROA_w |
                   L1. |  -.0237382   .0057793    -4.11   0.152    -.0971712    .0496947
                       |
                 _cons |   1.130338   .1738739     6.50   0.097     -1.07894    3.339615
----------------------------------------------------------------------------------------

Absorbed degrees of freedom:
-------------------------------------------------------+
   Absorbed FE | Categories  - Redundant  = Num. Coefs |
---------------+---------------------------------------|
 current_gvn_f |         2           2           0    *|
 industry_year |         3           0           3     |
-------------------------------------------------------+
* = FE nested within cluster; treated as redundant for DoF computation

. est sto gvn_lag1_subass6

. 
. *outreg2 [gvn_lag1_subass1 gvn_lag1_subass2 gvn_lag1_subass3 gvn_lag1_subass4 gvn_lag1_subass6] using TableA13.te
> x, replace label dec(3)
. 
. log close
      name:  <unnamed>
       log:  C:\Users\Siyao\Dropbox\Yue-Siyao\Project Subsidy\PSRM replication files\governor_details.log
  log type:  text
 closed on:  18 Aug 2022, 21:40:03
-------------------------------------------------------------------------------------------------------------------
